Skip to content

Instantly share code, notes, and snippets.

@handstandsam
handstandsam / MyLifecycleOwner.kt
Last active May 19, 2024 02:18
Jetpack Compose OverlayService. You have to have all the correct permissions granted and in your manifest, but if you do, this this will show a green box with "Hello" in it!
import android.os.Bundle
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleRegistry
import androidx.savedstate.SavedStateRegistry
import androidx.savedstate.SavedStateRegistryController
import androidx.savedstate.SavedStateRegistryOwner
internal class MyLifecycleOwner : SavedStateRegistryOwner {
private var mLifecycleRegistry: LifecycleRegistry = LifecycleRegistry(this)
private var mSavedStateRegistryController: SavedStateRegistryController = SavedStateRegistryController.create(this)
@ajayvignesh01
ajayvignesh01 / Tweet.tsx
Created February 24, 2024 06:03
A Tiptap extension to embed Tweets
import { NodeViewProps, NodeViewWrapper } from '@tiptap/react'
import { nodePasteRule, ReactNodeViewRenderer } from '@tiptap/react'
import { mergeAttributes, Node } from '@tiptap/core'
import { Tweet } from 'react-tweet'
export const TweetComponent = ({ node }: NodeViewProps) => {
const url = node.attrs.url
const tweetIdRegex = /\/status\/(\d+)/g
const id = tweetIdRegex.exec(url)?.[1]
@tobyselway
tobyselway / laravel_setup.md
Last active May 19, 2024 01:50
Initial Setup for Laravel Projects

Initial Setup

1. Clone the repository

Find a location on your computer where you want to store the project. A directory made for projects is generally a good choice.

Launch a bash console there and clone the project.

git clone https://github.com/organization/project.git

2. cd into the project

@NordicGamerFE
NordicGamerFE / performancemodsold.md
Last active May 19, 2024 01:50
Performance mods 1.8.9 and below

Performance Mods

A list of performance-enhancing mods for 1.8.9 and below.

Any suggestions/complaints?
Join our discord or use the gist comments.

Mods marked as "Dangerous" might be unstable, and cause some unexpected behaviour.

Home

Forge 1.8.9

@dhh
dhh / linux-setup.sh
Last active May 19, 2024 02:21
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl btop \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
@sasadep
sasadep / mat_to_csv.py
Created January 4, 2017 23:18
convert .mat file to .csv file
import scipy.io
import pandas as pd
mat = scipy.io.loadmat('path_to_/fiename.mat')
mat = {k:v for k, v in mat.items() if k[0] != '_'}
data = pd.DataFrame({k: pd.Series(v[0]) for k, v in mat.iteritems()})
data.to_csv("fiename.csv")
@HexedHero
HexedHero / mc_client_performance_guide.md
Last active May 19, 2024 01:46
Performance guide for Minecraft 1.20.6+ Clients

Performance guide for Minecraft 1.20.6+ Clients

📜 Fabric

Fabric is the "modern" Minecraft modding software that is very modular.
We use Fabric in this guide so install it by going to https://fabricmc.net/use/ Download the .jar or .exe and run it.

Below is a list of performance and utility mods to make your Minecraft experience better and most importantly smooth.
The list is in order of most importance and they all work together including what they do with why to use them.

@primaryobjects
primaryobjects / hotspot-keepalive.bat
Last active May 19, 2024 01:45
Script to Enable Windows 10 Wifi Mobile Hotspot Automatically and Keep Alive on Disconnect
PowerShell -Command "Set-ExecutionPolicy Unrestricted" >> "%TEMP%\StartupLog.txt" 2>&1
PowerShell C:\Users\YOUR_USERNAME\Desktop\hotspot-keepalive.ps1 >> "%TEMP%\StartupLog.txt" 2>&1
Windows Registry Editor Version 5.00
;--------
;-------- Remove Paint 3D Edit from context menu for image files
;--------
[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\.bmp\Shell\3D Edit]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\.jpeg\Shell\3D Edit]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\.jpe\Shell\3D Edit]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\.jpg\Shell\3D Edit]
@Ravarcheon
Ravarcheon / spectralRotation.py
Created May 18, 2024 13:23
rotates an audio file by 90 degrees in the spectrum while being a reversible process with minimal loss (only floating point errors which are like -150 dB but thats literally silence ahaha~)
import numpy as np
import soundfile as sf
from scipy.fftpack import fft, ifft
def rotateSignal(signal,flip):
if flip:
signal = signal[::-1]
x = np.concatenate((signal, signal[1:][::-1])) # concatenating the array with a reverse of itself makes it such that the fourier transform doesn't layer over a reversed version of itself in the inverse fft
rotSig = np.real(ifft(x))